From 49094cac1b418fef528c3d3991230eccb4cdd513 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 9 Aug 2010 16:35:27 +0100 Subject: [PATCH] scheduler: Add a per-scheduler yield callback Signed-off-by: George Dunlap --- xen/common/schedule.c | 6 ++++++ xen/include/xen/sched-if.h | 1 + 2 files changed, 7 insertions(+) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index c3a897f546..497da1862c 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -642,6 +642,12 @@ static long do_poll(struct sched_poll *sched_poll) /* Voluntarily yield the processor for this allocation. */ static long do_yield(void) { + struct vcpu * v=current; + + vcpu_schedule_lock_irq(v); + SCHED_OP(VCPU2OP(v), yield, v); + vcpu_schedule_unlock_irq(v); + TRACE_2D(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id); raise_softirq(SCHEDULE_SOFTIRQ); return 0; diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 4fbf80c612..3808344d11 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -107,6 +107,7 @@ struct scheduler { void (*sleep) (const struct scheduler *, struct vcpu *); void (*wake) (const struct scheduler *, struct vcpu *); + void (*yield) (const struct scheduler *, struct vcpu *); void (*context_saved) (const struct scheduler *, struct vcpu *); struct task_slice (*do_schedule) (const struct scheduler *, s_time_t, -- 2.30.2